﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.Stores;

namespace PMS.Data.EntityMap.Stores
{
    /// <summary>
    /// Represents a store mapping configuration
    /// </summary>
    public partial class StoreMap : PMSEntityTypeConfiguration<Store>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<Store> builder)
        {
            builder.ToTable("bus_stores");
            builder.HasKey(store => store.Id);

            builder.Property(store => store.Name).HasMaxLength(500).IsRequired();
            builder.Property(store => store.Url).HasMaxLength(500).IsRequired();
            builder.Property(store => store.Hosts).HasMaxLength(1024).IsRequired();
            builder.Property(store => store.TimeZoneId).HasMaxLength(128);
            builder.Property(store => store.CompanyName).HasMaxLength(200);
            builder.Property(store => store.CompanyAddress).HasMaxLength(500);
            builder.Property(store => store.CompanyPhoneNumber).HasMaxLength(128);

            base.Configure(builder);
        }

        #endregion
    }
}
